using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ManagementClinic.Data.Models.Mapping
{
    public class KHAM_BENHMap : EntityTypeConfiguration<KHAM_BENH>
    {
        public KHAM_BENHMap()
        {
            // Primary Key
            this.HasKey(t => t.ID);

            // Properties
            this.Property(t => t.HEN_KHAM)
                .HasMaxLength(100);

            this.Property(t => t.KET_LUAN)
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("KHAM_BENH");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.ID_PHIEU_KHAM).HasColumnName("ID_PHIEU_KHAM");
            this.Property(t => t.SO_KHAM).HasColumnName("SO_KHAM");
            this.Property(t => t.SO_XEP_HANG).HasColumnName("SO_XEP_HANG");
            this.Property(t => t.HEN_KHAM).HasColumnName("HEN_KHAM");
            this.Property(t => t.KET_LUAN).HasColumnName("KET_LUAN");

            // Relationships
            this.HasRequired(t => t.PHIEU_KHAM)
                .WithMany(t => t.KHAM_BENH)
                .HasForeignKey(d => d.ID_PHIEU_KHAM);

        }
    }
}
